各位邦友…最早的時候…小編clone repository的時候…也是透過HPPTS,三不五時要跟repository互動的時候,就要輸入帳號密碼,也不知道是網路不穩,還是機制怎樣的,後來同事就請大家使用SSH Key囉。這種「設定一次」,設定方式又是別人「複製」給你的,你只是「貼上」而已。通常都不是很了解其「起作用」的原因(或一知半解),反正會跑就行了。剛好藉由這個機會有這個情境。順便「整理一下」。
ssh-keygen -b 4096(linux),因為小編是windows電腦,所以安裝Git之後,可以用Git Bash(terminal)來產生。
  $ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
bebright@github.com_rsa.pub(.pub這一個是公鑰) 
 
.ssh\config
    # 舊的
    Host github.com (別名 !!! > 跟Hostname 一樣)
        User git
        Hostname github.com
        IdentityFile ~/.ssh/github_rsa
    # 新的
    Host bebright (別名 !!! > 跟Hostname 不一樣 > 本來就不應該有「相同別名」)
        User git
        Hostname github.com
        IdentityFile ~/.ssh/bebright@github.com_rsa
.ssh\config之前是可以clone下來的。.ssh\config,舊的Host的「別名」就是github.com,所以它就用舊的SSH key去溝通,所以就沒權限。因為origin  git@github.com:bebright/slack-demo.git(github.com,這一個是「別名」)
    $ git clone git@github.com:bebright/slack-demo.git
    $ git remote -v
    origin  git@github.com:bebright/slack-demo.git (fetch)
    origin  git@github.com:bebright/slack-demo.git (push)
    $ git push
    ERROR: Permission to bebright/slack-demo.git denied to beebright.(舊的帳號名稱)
github.com:bebright/slack-demo.gitbebright:bebright/slack-demo.git  $ git remote set-url origin git@bebright:bebright/slack-demo.git
  $ git remote -v
  origin  git@bebright:bebright/slack-demo.git (fetch)
  origin  git@bebright:bebright/slack-demo.git (push)
  $ git push
  Everything up-to-date
~/.gitconfig會有git全域(global)的設定(舊帳號),如下(設定片斷)
  [user]
  name = beebright
  email = xxxxxx@xxx.xxx.xxx
  $ git config user.name "new account name"
  $ git config user.email "new account mail"
專案加上.travis.yml,push上去
小編是用Node.js,完整程式語言列表
這邊小編好奇,只加一行會如何…
  language: node_js
 
.travis.yml加上通知(to Slack)
 
  language: node_js
  notifications:
  slack: beebright:DxPZYpdd26Ni3vFGQFKngXK3
 
今天就先這樣囉…Next
待續…